//-------------------------------------------------------------------
//	Copyright (c) 2012-2014 Zhirnov Andrey
//	This file is part of the "UXGEN-ES" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#pragma once

#include "Graphics/Primitives/Vertices.h"
#include "Graphics/Primitives/Indices.h"

namespace Engine
{
namespace Primitives
{

	//
	// Point
	//

	template <typename Vert, gl_primitive::type PrimitiveType>
	struct Point : PointIndices< PrimitiveType >
	{
	// types
	public:
		typedef Vert							vertex_t;
		typedef Point< Vert, PrimitiveType >	Self;


	// variables
	public:
		Vert	point;


	// methods
	public:
		Point () {}
		Point (const Vert &p) : point(p) {}

		static uint VerticesCount ()
		{
			return 1;
		}

		void GetVertices (void *data) const
		{
			MemCopy( data, this, sizeof(*this) );
		}

		int ScissorTest (const rect &scissorRect) const
		{
			if ( scissorRect.IsInnerPoint( point.position ) )
				return 0;	// fully visible

			return -1;	// cut
		}

		Self Crop (const rect &scissorRect) const
		{
			WARNING( "not supported for 1 point!" );
			return *this;
		}
	};


	typedef Point< LineVertex2D, gl_primitive::POINT >			Point2D;
	typedef Point< LineVertex2D, gl_primitive::LINE >			LinePoint2D;
	typedef Point< LineVertex2D, gl_primitive::LINE_STRIP >		LineStripPoint2D;
	typedef Point< Vertex2D, gl_primitive::TRIANGLE >			TrianglePoint2D;
	typedef Point< Vertex2D, gl_primitive::TRIANGLE_STRIP >		TriangleStripPoint2D;
	//typedef Point< Vertex2D, gl_primitive::LINE_STRIP >			TriangleStripPoint2D;


}	// Primitives
}	// Engine
